﻿namespace FiftyOne.Foundation.Mobile.Detection.Wurfl.Handlers
{
    using System;

    internal class LGHandler : RegexSegmentHandler
    {
        private static readonly string PATTERN = "[^ /]+";

        internal LGHandler() : base(PATTERN, new int[] { 0x3e8 })
        {
        }

        protected internal override bool CanHandle(string userAgent)
        {
            return (userAgent.StartsWith("LG") && base.CanHandle(userAgent));
        }

        internal override int GetSegmentWeight(int index, int numberOfSegments)
        {
            if (index < base._weights.Length)
            {
                return base._weights[index];
            }
            return 1;
        }
    }
}

